      SUBROUTINE UNTAB ( STRING )
C*
C*                  *******************************
C*                  *******************************
C*                  **                           **
C*                  **          UNTAB            **
C*                  **                           **
C*                  *******************************
C*                  *******************************
C*
C*     SUBPROGRAM :
C*          REMOVE TABS
C*
C*     AUTHOR :
C*          ART RAGOSTA
C*          MS 207-5
C*          AMES RESEARCH CENTER
C*          MOFFETT FIELD, CA  94035
C*          (415) 694-5578
C*
C*     PURPOSE :
C*          REPLACE A STRING WITH THE SAME STRING WHERE TABS ARE
C*          REPLACED BY AN APPROPRIATE NUMBER OF BLANKS TO HAVE
C*          SIMILAR SPACING.
C*
C*     INPUT ARGUMENTS :
C*          STRING - STRING FROM WHICH TABS ARE TO BE REMOVED
C*
C*     OUTPUT ARGUMENTS :
C*          STRING - SAME STRING WITH BLANKS REPLACING TABS(INPLACE)
C*
C*     INTERNAL WORK AREAS :
C*          ITAB - AN ARRAY CONTAINING THE TAB STOP SETTINGS.
C*          LINE - TEMPORARY STORAGE FOR TABBED STRING.
C*
C*     COMMON BLOCKS :
C*          NONE
C*
C*     FILE REFERENCES :
C*          NONE
C*
C*     DATA BASE ACCESS :
C*          NONE
C*
C*     SUBPROGRAM REFERENCES :
C*          NONE
C*
C*     ERROR PROCESSING :
C*          NONE
C*
C*     TRANSPORTABILITY LIMITATIONS :
C*          THE NON-STANDARD DATA STATEMENT SETS TAB CHARACTER TO ASCII 9.
C*          ( TRANSPORTABLE VERSION IS COMMENTED )
C*
C*     ASSUMPTIONS AND RESTRICTIONS :
C*          NONE
C*
C*     LANGUAGE AND COMPILER :
C*          ANSI FORTRAN 77
C*
C*     VERSION AND DATE :
C*          VERSION I.1     29-july-1985
C*
C*     CHANGE HISTORY :
C*          29-JUL-85    ITPTR FIXED (INITIALIZED)
C*          15-OCT-84    INITIAL VERSION
C*
C***********************************************************************
C*
      CHARACTER *(*) STRING
      CHARACTER *255 LINE
      CHARACTER *1 TAB
      DIMENSION ITAB(32)
      DATA ITAB / 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 98, 106,
     $  114, 122, 130, 138, 146, 154, 162, 170, 178, 186, 195, 203,
     $  211, 219, 227, 235, 243, 251, 10000 /
C
C --- NON-STANDARD DATA STATEMENT :
C
      DATA TAB/9/
C
C --- STANDARD REPLACEMENT FOR ABOVE DATA STATEMENT :
C     TAB = CHAR ( 9 )
C
      LINE   = STRING
      STRING = ' '
      L      = LENGTH(LINE)
      LL     = LEN(STRING)
      K      = 1
      ITPTR  = 1
      DO 20 I = 1,L
          IF ( LINE(I:I) .EQ. TAB ) THEN
C
C ------ FIND NEXT TAB STOP
C
5            IF ( K .GE. ITAB(ITPTR)) THEN
                ITPTR = ITPTR + 1
                GO TO 5
             ENDIF
C
C ------ SKIP BLANKS TO TAB STOP ( ALREADY BEEN INITIALIZED TO BLANKS )
C
10           IF ( K .LT. ITAB(ITPTR)) THEN
                K = K + 1
                GO TO 10
             ENDIF
          ELSE
C
C ------ COPY NON-TAB CHARACTERS
C
             STRING(K:K) = LINE(I:I)
             K = K + 1
          ENDIF
          IF ( K .GT. LL ) RETURN
20        CONTINUE
      RETURN
      END
C
C---END UNTAB
C
